using System;
using System.Windows.Media;
using _3DTicTacToe.Core;

namespace _3DTicTacToe
{
    partial class GameWindow
    {
        public static Color InvertColor(Color color)
        {
            return Color.FromArgb(color.A,
                    (byte)(255 - color.R),
                    (byte)(255 - color.G),
                    (byte)(255 - color.B));
        }

        void GameOnTurn(Turn turn)
        {
            Action a = () =>
                           {
                               var player = _game.NextPlayer;

                               playerBorder.Background = new SolidColorBrush(player.Color);
                               playerControl.Foreground = new SolidColorBrush(InvertColor(player.Color));
                               playerControl.Content = player.Name;
                           };
            Dispatcher.Invoke(a, null);
        }
    }
}